home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1986 November / 1986-11.d64 / match blox (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  82 lines

  1. 100 gosub820:poke 53280,6:poke 53281,6:print chr$(8)"[147][154]"spc(14)"match blox"
  2. 110 l$(1)="[129][207][183][208][157][157][157][180] [170][157][157][157][204][175][186][146][145][145]":l$(2)="[154]"+right$(l$(1),21)
  3. 120 na$(1)="uni-color":na$(2)="  cross":na$(3)="no center"
  4. 130 na$(4)="4 corners":na$(5)=" 5 points":mv$="moves"
  5. 140 dim y(10),p$(10),cl(5,9):for i=1 to 9:read v(i,1),v(i,2),v(i,3),v(i,4)
  6. 150 next:mt=1:up=8:dn=14:lm=16:rm=22:te=5:qx=11:qy=19:mv=-1:q=14:x=8:p=0
  7. 160 for c=1 to 9:y(c)=x:p$(c)=l$(2):z=int(10*rnd(1))
  8. 170 if z<=5 then y(c)=q:p$(c)=l$(1)
  9. 180 next
  10. 190 t$="[207][208][157][157][204][186][145]":for rx=1 to 5:for i=1 to 9:cl(rx,i)=8:next i,rx
  11. 200 for i=1 to 9:cl(1,i)=14:cl(3,i)=14:next:cl(3,5)=8
  12. 210 cl(2,2)=14:cl(2,4)=14:cl(2,5)=14:cl(2,6)=14:cl(2,8)=14
  13. 220 cl(4,1)=14:cl(4,3)=14:cl(4,7)=14:cl(4,9)=14
  14. 230 cl(5,1)=14:cl(5,3)=14:cl(5,5)=14:cl(5,7)=14:cl(5,9)=14
  15. 240 print spc(12)"[155][175][157][157][170]1[146][180][157][157][183][145][154] uni-color":print spc(12);
  16. 250 print"[155][175][157][157][170]2[146][180][157][157][183][145][154] cross":printspc(12)"[155][175][157][157][170]3[146][180][157][157][183][145][154] no center"
  17. 260 print spc(12)"[155][175][157][157][170]4[146][180][157][157][183][145][154] 4 corners"
  18. 270 print spc(12)"[155][175][157][157][170]5[146][180][157][157][183][145][154] 5 points"
  19. 280 print tab(12);"your choice[145]  [155][175][157][157][170] [146][180][157][157][183][154]"
  20. 290 s=127-peek(56320):if s=4 then mt=mt-1:if mt<1 then mt=1
  21. 300 if s=8 then mt=mt+1:if mt>5 then mt=5
  22. 310 if s>=15 then dz=mt:gk=mt:goto 330
  23. 320 poke 1929,mt+176:poke 56201,15:goto 290
  24. 330 print chr$(31)"[147]";
  25. 340 for i=0 to 23:print"                                       "
  26. 350 mm=1063+(40*i):poke mm,160:poke mm+54272,6:next:poke 2023,160:poke 56295,6
  27. 360 print"                                       ":poke 53281,15
  28. 370 print"";:print spc(15)""na$(gk)""
  29. 380 print""spc(3)"match[157][157][157]blox"
  30. 390 e=1:f=3:print"":for bj=1 to 3:print spc(31);:for ai=e to f
  31. 400 poke 646,cl(gk,ai):print t$;:next:e=e+3:f=f+3:print"":next
  32. 410 gosub 420:goto 450
  33. 420 print""tab(15)""p$(1)p$(2)p$(3):print""tab(15)""p$(4)p$(5)p$(6)
  34. 430 print""tab(15)""p$(7)p$(8)p$(9)
  35. 440 poke 782,qy:poke 781,qx:poke 783,0:sys 65520:print"[144][166][157]";:return
  36. 450 mv=mv+1:u=0:for c=1 to 9:if y(c)=x then u=u+1
  37. 460 next:if tc=1 then tc=0:mv=mv-1
  38. 470 if mv>0 then print""spc(16)"move"mv:gosub 440
  39. 480 if gk=1 and u=9 then 750
  40. 490 if u=9 then 780
  41. 500 if gk=2 and u=5 and y(2)+y(4)+y(5)+y(6)+y(8)=40 then 750
  42. 510 if gk=3 and u=8 and y(5)=14 then 750
  43. 520 if gk=4 and u=4 and y(1)+y(3)+y(7)+y(9)=32 then 750
  44. 530 if gk=5 and u=5 and y(1)+y(3)+y(5)+y(7)+y(9)=40 then 750
  45. 540 goto 610
  46. 550 p=u:if y(u)=x then tc=1:gosub 420:goto 450
  47. 560 w(1)=v(u,1):w(2)=v(u,2):w(3)=v(u,3):w(4)=v(u,4)
  48. 570 for g=1 to 4:w=0:if y(w(g))=x then w=1
  49. 580 if w=1 then y(w(g))=q:p$(w(g))=l$(1)
  50. 590 if w=0 and y(w(g))=q then y(w(g))=x:p$(w(g))=l$(2)
  51. 600 next:y(u)=x:p$(u)=l$(2):gosub420:goto450
  52. 610 poke 204,0:jy=15-peek(56320)and15:jb=16-peek(56320)and16
  53. 620 if jb=0 then gosub 820:u=te:goto 550
  54. 630 if jy=8 then jy=3
  55. 640 if jy<1 orjy>4 then 610
  56. 650 gosub 820:on jy goto 660,680,700,720
  57. 660 if qx=up then 610
  58. 670 qx=qx-3:te=te-3:goto 740
  59. 680 ifqx=dn then 610
  60. 690 qx=qx+3:te=te+3:goto 740
  61. 700 if qy=rm then 610
  62. 710 qy=qy+3:te=te+1:goto 740
  63. 720 if qy=lm then 610
  64. 730 qy=qy-3:te=te-1
  65. 740 gosub 420:goto 610
  66. 750 if mv=1 then mv$="move"
  67. 760 gosub 830:print"       you solved it in"mv;mv$:s1=30:s2=20:s3=-1
  68. 770 gosub 840:goto 800
  69. 780 gosub 830:print"     no moves available...game over":s1=17:s2=35:s3=1
  70. 790 gosub 840
  71. 800 print"     press firebutton to play again"
  72. 810 wait 56320,16,16:for i=54272 to 54287:poke i,0:next:run
  73. 820 poke 204,1:poke 207,0:return
  74. 830 gosub 440:print"[154] ":return
  75. 840 poke 54296,15:poke 54295,0:poke 54273,40:poke 54278,240:poke 54277,0
  76. 850 poke 54276,17:for a=s1 to s2 step s3:for b=a to 60-a
  77. 860 poke 54273,b:next b,a:poke 54273,3:poke 54276,0:return
  78. 870 data 2,4,5,10,1,3,10,10,2,5,6,10,1,7,10,10,2,4,8,6,3,9,10,10,4,5,8,10,7,9
  79. 880 data 10,10,8,5,6,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,240,0,3,248,0,7,252,0
  80. 890 data 7,252,0,7,252,0,3,248,0,1,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  81. 900 data 0,0,0,0,0,0,0,0,0,190
  82.